{template header common}
<script type="text/javascript" src="{__ROOT__}statics/js/haidao.validate.js?v={HD_VERSION}"></script>
<script type="text/javascript" src="{SKIN_PATH}statics/js/region-selection.js?v={HD_VERSION}"></script>
	<div class="mui-content">
	    <form name="ajax_district" action="{url('member/address/add')}" method="POST">
	    	<div class="mui-input-group add-address">
		        <div class="mui-input-row">
		            <label>收货人</label>
		            <input type="text" class="mui-input-clear" value=""  placeholder="请输入收货人地址" name="name"/>
		        </div>
		        <div class="mui-input-row">
		            <label>手机号码</label>
		            <input type="text" class="mui-input-clear" value="" placeholder="请输入手机号码" name="mobile"/>
		        </div>
		        <div class="mui-input-row">
		            <label>邮政编码</label>
		            <input type="number" class="mui-input-clear" value="" placeholder="请输入邮政编码" name="zipcode"/>
		        </div>
		        <div class="mui-input-row">
		            <label>所在地区</label>
					<input class="district-text-id" type="hidden" name="district_id" value="">
		            <span class="input district-text-show">请选择收货地区</span>
		        </div>
		        <div class="mui-input-row">
		            <label>详细地址</label>
		            <input type="text" class="mui-input-clear" value="" placeholder="请输入详细地址" name="address"/>
		        </div>
		    </div>
	    	<div class="padding-lr margin-top">
	    		<button type="submit" class="mui-btn mui-btn-primary full hd-h4">确认添加收货地址</button>
	    	</div>
	    </form>
	</div>
	{template footer common}
</body>
</html>
<script>
var _referer = '{urldecode($_GET["referer"])}';
var ajax_district=$("form[name=ajax_district]").Validform({
	ajaxPost:true,
	callback:function(ret){
		if(ret.status == 1){
			$.tips({content:ret.message});
			var url = _referer || ret.referer;
			window.location.href = url;
		}else{
			$.tips({content:ret.message});
		}
	}
});
$.regionSelect({
	url: "{url('ajax_district')}",
	id: "{$address['district_id']}",
	autor: $(".district-text-show"),
	callback: function(id,name){
		$(".district-text-id").val(id[id.length-1]);
		var html = '';
		$.each(name, function() {
			html += this + " ";
		});
		$(".district-text-show").html(html)
	}
});
</script>
